<script type="text/javascript" src="/static/jquery.dimensions.js"></script>
<script type="text/javascript" src="/static/jquery.date_input.js"></script>
<link rel="stylesheet" href="/static/date_input.css" type="text/css">

<script type="text/javascript" language="javascript" charset="utf-8">
$(document).ready(function(){
$("#tasks_add_title").focus(
        function () {
            if ($(this).val() == "New task...") {
                $(this).val('');
            }
        });
});
$.extend(DateInput.DEFAULT_OPTS, {
    stringToDate: function(string) {
        var matches;
        if (matches = string.match(/^(\d{4,4})-(\d{2,2})-(\d{2,2})$/)) {
            return new Date(matches[1], matches[2] - 1, matches[3]);
        } else {
            return null;
        };
    },

    dateToString: function(date) {
        var month = (date.getMonth() + 1).toString();
        var dom = date.getDate().toString();
        if (month.length == 1) month = "0" + month;
        if (dom.length == 1) dom = "0" + dom;

        return date.getFullYear() + "-" + month + "-" + dom;
    }
});
$($.date_input.initialize);
</script>

<h2>add</h2>

<form id="task_add" method="post" action="/tasks/add/post/">
    {{ form.reply }}
    {{ form.title }}
    {{ form.responsible }}
    {{ form.due }}
    <input type="submit" value="Add" />
</form>
